package cn.kgc.smbms.service;

import cn.kgc.smbms.mapper.UserMapper;
import cn.kgc.smbms.pojo.User;
import cn.kgc.smbms.pojo.UserExt;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImp implements UserService {
    @Resource
    private UserMapper userMapper;
    @Override
    public User login(String userCode, String userPassword) {
        User user=new User();
        user.setUserCode(userCode);
        user.setUserPassword(userPassword);
        return userMapper.login(user);
    }

    @Override
    public List<User> selectAllUser(int pageNo,int pageSize,String userName,String userRole) {
        return userMapper.selectAllUserByMoreValue(pageNo,pageSize,userName,userRole);
    }

    @Override
    public int selectCount() {
        return userMapper.totalCount();
    }

    @Override
    public User selectUserById(Long id) {
        return userMapper.selectByPrimaryKey(id);
    }

    @Override
    public int modifyUserById(User user) {
        return userMapper.updateByPrimaryKey(user);
    }

    @Override
    public int deleteUserById(String id) {
        return userMapper.deleteByPrimaryKey(id);
    }
}
